/*
 *--------------------------------------------------------------------------
 *   Battlefield - A Realtime Network Multiplayer Game
 *   =======================================================
 *   Developed by Group D02 - 2009/2010 Semester 4 - CS2103
 *     Harry Nguyen Duy Hoang <nnduyhoang@yahoo.co.uk>
 *     Kent Chng Siang Rong <fivefootway@gmail.com>
 *     Lim Yong Peng <limpeng1986@gmail.com>
 *     Loh Xiankun <u0807185@nus.edu.sg>
 *   Instructed by
 *     Dr. Damith C.Rajapakse <damith@gmail.com>
 *   =======================================================
 *   $Id: UnitCell.java 579 2010-07-26 12:23:07Z YongPeng $
 *   $LastChangedDate: 2010-07-26 12:23:07 +0000 (Mon, 26 Jul 2010) $
 *   $LastChangedBy: YongPeng $
 *--------------------------------------------------------------------------
 */
package battlefield.entity;

/**
 *
 * @author Harry Nguyen
 */
public class UnitCell extends Cell {

    private CellImage unitImage;

    /**
     * Returns the CellImage of the the unit
     * @return CellImage
     * @see CellImage
     */
    public CellImage getUnitImage() {
        return unitImage;
    }

    /**
     * Sets the CellImage of the Unit
     * @param unitImage
     */
    public void setUnitImage(CellImage unitImage) {
        this.unitImage = unitImage;
    }

    @Override
    public boolean equals(Object obj) {

        if (obj == null) {
            return false;
        }

        if (!(obj instanceof UnitCell)) {
            return false;
        }

        UnitCell c = (UnitCell) obj;

        if (this.getBackgroundImage() == null || !this.getBackgroundImage().equals(c.getBackgroundImage())) {
            return false;
        }

        if (this.getDestroyedImage() == null || !this.getDestroyedImage().equals(c.getDestroyedImage())) {
            return false;
        }

        if (this.getUnitImage() == null || !this.getUnitImage().equals(c.getUnitImage())) {
            return false;
        }

        return this.getState() == c.getState();
    }
}
